/*
 * @Author: qwlbwm 18370818801qwl./
 * @Date: 2023-09-06 09:12:16
 * @LastEditors: whereamazinghappen 306702547@qq.com
 * @LastEditTime: 2023-09-18 10:41:17
 * @FilePath: \checc-business-module-web-kgpt-dev\src\api\examineManage.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import * as proxy from '@/constants/proxy';
import request from '@/utils/request';
import { exportMethod } from '@/utils/utils';
import { ObjectType, ResponseDataPromise } from 'typings/interfaces';
// import { Pagination } from '@/components/Records/types'
// import axios from 'axios'
// import { getToken } from '@/utils/auth'
export interface IndexListParams extends ObjectType {
    param?: string
    type: string  //1中交2中咨
}

//年度考核题库
//年度考核题库 --外层列表
export const getAnnualList = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-bank/pageList',
    method: 'post',
    data,
})
// export const exportStandardIndexRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
// request({
//     url: proxy.CHECC_API_CMS + '/khgl/question-bank/export',
//     method: 'post',
//     data,
//     responseType: 'blob'
// })
export function exportStandardIndexRequest(data: any) {
    const params = {
      url: proxy.CHECC_API_CMS + '/khgl/question-bank/export',
      method:'post',
      data,
      fileName: '年度考核题库表格',
     }
    return exportMethod(params)
}
//-------------下载模板
export function downMb() {
    const params = {
      url: proxy.CHECC_API_CMS + '/khgl/question/download',
      method:'get',
      fileName: '模板实例',
     }
    return exportMethod(params)
}
//-------------上传模板
export const importMb = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/import',
    method: 'post',
    data,
})

export const deleteStandardIndexRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-bank/delete',
    method: 'post',
    data,
})
export const hadLock = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-bank/lock',
    method: 'post',
    data,
})
export const hadUnLock = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-bank/unlock',
    method: 'post',
    data,
})

export const addAnnual = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-bank/insert',
    method: 'post',
    data,
})
export const updateAnnual = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question-bank/update',
    method: 'post',
    data,
})
//年度考核题库 --考题管理
export const getManageList = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/list',
    method: 'post',
    data,
})
//年度考核题库 --考题管理
export const getManageList1 = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/list1',
    method: 'post',
    data,
})
export const exportManageRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/export',
    method: 'post',
    data,
    responseType: 'blob'
})
export const deleteManageRequest = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/delete',
    method: 'post',
    data,
})
//添加题库
//---- 父级路径列表
export const getFaNumber = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/parentQuestion',
    method: 'post',
    data,
})
// save保存
export const saveManage = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/insert',
    method: 'post',
    data,
})
export const detailManage = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/detail',
    method: 'post',
    data,
})
// 编辑
export const updateManage = (data: ObjectType): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/update',
    method: 'post',
    data,
})
//-------------生成考核
export const getAssment = (): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/my-index-annual-examine/getCompanyList',
    method: 'get',
})
//-------------生成考核  保存
export const saveAssment = (data): ResponseDataPromise<ObjectType> =>
request({
    url: proxy.CHECC_API_CMS + '/khgl/question/generateExamine',
    method: 'post',
    data,
})
